package org.thanos.demo.config;

import java.io.Serializable;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;

public class DynamicTaskQueue extends LinkedBlockingQueue<String> implements Serializable {

    private final AtomicBoolean done;

    DynamicTaskQueue(int capacity) {
        super(capacity);
        done = new AtomicBoolean(false);
    }

    public boolean isDone() {
        return done.get();
    }

    public void setDone(boolean done) {
        this.done.compareAndSet(!done, done);
    }
}
